/*
 * XML Type:  XDBSchemaSource
 * Namespace: http://www.seedwill.com/xul/core
 * Java type: com.seedwill.xul.core.XDBSchemaSource
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.core.impl;
/**
 * An XML XDBSchemaSource(@http://www.seedwill.com/xul/core).
 *
 * This is a complex type.
 */
public class XDBSchemaSourceImpl extends com.seedwill.xul.core.impl.XSourceImpl implements com.seedwill.xul.core.XDBSchemaSource
{
    private static final long serialVersionUID = 1L;
    
    public XDBSchemaSourceImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName FILTER$0 = 
        new javax.xml.namespace.QName("", "filter");
    private static final javax.xml.namespace.QName DBS$2 = 
        new javax.xml.namespace.QName("", "dbs");
    
    
    /**
     * Gets array of all "filter" elements
     */
    public com.seedwill.xul.core.XSchemaFilter[] getFilterArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(FILTER$0, targetList);
            com.seedwill.xul.core.XSchemaFilter[] result = new com.seedwill.xul.core.XSchemaFilter[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "filter" element
     */
    public com.seedwill.xul.core.XSchemaFilter getFilterArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchemaFilter target = null;
            target = (com.seedwill.xul.core.XSchemaFilter)get_store().find_element_user(FILTER$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "filter" element
     */
    public int sizeOfFilterArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(FILTER$0);
        }
    }
    
    /**
     * Sets array of all "filter" element
     */
    public void setFilterArray(com.seedwill.xul.core.XSchemaFilter[] filterArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(filterArray, FILTER$0);
        }
    }
    
    /**
     * Sets ith "filter" element
     */
    public void setFilterArray(int i, com.seedwill.xul.core.XSchemaFilter filter)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchemaFilter target = null;
            target = (com.seedwill.xul.core.XSchemaFilter)get_store().find_element_user(FILTER$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(filter);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "filter" element
     */
    public com.seedwill.xul.core.XSchemaFilter insertNewFilter(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchemaFilter target = null;
            target = (com.seedwill.xul.core.XSchemaFilter)get_store().insert_element_user(FILTER$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "filter" element
     */
    public com.seedwill.xul.core.XSchemaFilter addNewFilter()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XSchemaFilter target = null;
            target = (com.seedwill.xul.core.XSchemaFilter)get_store().add_element_user(FILTER$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "filter" element
     */
    public void removeFilter(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(FILTER$0, i);
        }
    }
    
    /**
     * Gets the "dbs" element
     */
    public com.seedwill.xul.core.XDBSource getDbs()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XDBSource target = null;
            target = (com.seedwill.xul.core.XDBSource)get_store().find_element_user(DBS$2, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * True if has "dbs" element
     */
    public boolean isSetDbs()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(DBS$2) != 0;
        }
    }
    
    /**
     * Sets the "dbs" element
     */
    public void setDbs(com.seedwill.xul.core.XDBSource dbs)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XDBSource target = null;
            target = (com.seedwill.xul.core.XDBSource)get_store().find_element_user(DBS$2, 0);
            if (target == null)
            {
                target = (com.seedwill.xul.core.XDBSource)get_store().add_element_user(DBS$2);
            }
            target.set(dbs);
        }
    }
    
    /**
     * Appends and returns a new empty "dbs" element
     */
    public com.seedwill.xul.core.XDBSource addNewDbs()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XDBSource target = null;
            target = (com.seedwill.xul.core.XDBSource)get_store().add_element_user(DBS$2);
            return target;
        }
    }
    
    /**
     * Unsets the "dbs" element
     */
    public void unsetDbs()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(DBS$2, 0);
        }
    }
}
